<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>资料详情</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/static/wx//lib/sui/sm.min.css">
    <link rel="stylesheet" href="/static/wx//lib/sui/sm-extend.min.css">
    <link rel="stylesheet" href="/static/wx/css/reset.css">
    <link rel="stylesheet" href="/static/wx/css/main.css">
    <link rel="stylesheet" href="/static/wx/css/public_main.css">
    <script type='text/javascript' src='/static/wx/lib/sui/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm-extend.min.js' charset='utf-8'></script>
    <script type="text/javascript" src="/static/wx/layui/layui.js"></script>
</head>

<body>
    <div class="page-group">
        <div class="page page-current" id="detail_no_audit">
            <!-- 主内容 -->
            <div class="content">
                <div class="item-card" style="padding:.5rem 0">
                    <div class="item-card-header">状态：{$data.info.stataus_str}</div>
                    <div class="item-card-content">
                        {if !empty($data.info.recordor_name)}
                        <div class="item-card-content-item">
                            代录人姓名：{$data.info.recordor_name}
                        </div>
                        {/if}
                        {if !empty($data.info.recordor_phone)}
                        <div class="item-card-content-item">
                            代录人手机号：{$data.info.recordor_phone}
                        </div>
                        {/if}
                        {if !empty($data.info.recordor_type)}
                        <div class="item-card-content-item">
                            代录人类型：{$data.info.recordor_type}
                        </div>
                        {/if}
                        {if (!empty($data.info.recordor_commit) && $data.status ==2) }
                        <div class="item-card-content-item">
                            请在{$data.info.recordor_commit} 前录入递交
                        </div>
                        {/if}
                        {if !empty($data.info.creat)}
                        <div class="item-card-content-item">
                            录入时间：{$data.info.creat}
                        </div>
                        {/if}
                    </div>
                </div>
                <div class="item-card">
                    <div class="item-card-header">
                        <div>保单险种</div>
                    </div>
                    <input type="hidden" value="{$data.goods_info.policy_num}" name ='policy_num'>
                    <input type="hidden" value="{$data.goods_info.p_id}" name ='p_id'>
                    <div class="item-card-content">
                        <div class="item-card-content-item">
                            保单号：{$data.goods_info.report_num}
                        </div>
                        <div class="item-card-content-item">
                            报案号：{$data.goods_info.policy_num}
                        </div>
                        <div class="item-card-content-item">
                            出险险种：{$data.goods_info.insurance_type_name}
                        </div>
                    </div>
                </div>
                {if $data.status !=2 }
                <div class="item-card" id="prompt-ok-html">
                    <div class="item-card-header">
                        <div>货品信息</div>
                        {if $data.status ==3 }
                        <div class="btn" id="prompt-ok">驳回</div>
                        <script>
                            $(document).on('click', '#prompt-ok', function () {
                                $.prompt('请输入驳回信息', function (value) {
                                    b=$('#prompt-ok-html').find('#prompt-ok-return');
                                    if(value.length == 0 && b.length>0 ) {
                                        b.remove();
                                        $('#prompt-ok').text('驳回');
                                        return;
                                    }
                                    if(value.length == 0 && b.length==0){
                                        return;
                                    }
                                    if(b.length>0){
                                        b.html('');
                                        $('#prompt-ok-return').append('修改内容：'+value+'<br />');
                                    }else {
                                        a=' <div class="edit-content" id="prompt-ok-return">';
                                        a+='修改内容：'+value+'<br />';
                                        a+='  </div>';
                                        $('#prompt-ok-html').append(a);
                                    }
                                    $('#prompt-ok').text('修改驳回原因');
                                });
                            });
                        </script>
                        {/if}
                        {if $data.status ==0 && $data.is_recordor !=1 && !empty($data.bohui_info.goods_return) }
                        <div class="btn" id="goodsUpdate">修改</div>
                        <script>
                            $(function () {
                                $('#goodsUpdate').on('touchend', function () {
                                    var poliecy = $("input[ name='policy_num']").val();
                                    location.href="{:url('Insurer/update1')}?policy_num="+poliecy;
                                    console.log(111);
                                });

                            });
                        </script>
                        {/if}
                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item">
                            货品类别：{$data.goods_info.goods_type_name}
                        </div>
                        <div class="item-card-content-item">
                            货品名称：{$data.goods_info.goods_name}
                        </div>
                        <div class="item-card-content-item">
                            数量与规格：{$data.goods_info.goods_num}
                        </div>
                        <div class="item-card-content-item">
                            <!--物品原值：{if !empty($info.goods_info.good_price)}{$info.goods_info.good_price }万元{/if}-->
                            物品原值：{if !empty($data.goods_info.good_price)}{$data.goods_info.good_price }万元{/if}
                        </div>
                        <div class="item-card-content-item">
                            评估价：{if !empty($data.goods_info.good_pg_price)}{$data.goods_info.good_pg_price }万元{/if}
                        </div>

                    </div>
                    {if $data.status == 0 && !empty($data.bohui_info.goods_return) }
                    <div class="edit-content">
                        {volist name="data.bohui_info.goods_return" id="goods_return"}
                        修改内容：{$goods_return}<br/>
                        {/volist}
                    </div>
                    {/if}
                </div>
                <div class="item-card" id="under_return-html">
                    <div class="item-card-header">
                        <div>货品受损</div>
                        {if $data.status ==3 }
                        <div class="btn" id="under_return">驳回</div>
                        <script>
                            $(document).on('click', '#under_return', function () {
                                $.prompt('请输入驳回信息', function (value) {
                                    b=$('#under_return-html').find('#under_return-return');
                                    if(value.length == 0 && b.length>0 ) {
                                        console.log(123);
                                        b.remove();
                                        $('#under_return').text('驳回');
                                        return;
                                    }
                                    if(value.length == 0 && b.length==0){
                                        return;
                                    }
                                    if(b.length>0){
                                        b.html('');
                                        $('#under_return-return').append('修改内容：'+value+'<br />');
                                    }else {
                                        a=' <div class="edit-content" id="under_return-return">';
                                        a+='修改内容：'+value+'<br />';
                                        a+='  </div>';
                                        $('#under_return-html').append(a);
                                    }
                                    $('#under_return').text('修改驳回原因');

                                });
                            });
                        </script>
                        {/if}
                        {if $data.status ==0 && $data.is_recordor !=1  && !empty($data.bohui_info.under_return)}
                        <div class="btn" id="underUpdate">修改</div>
                        <script>
                            $(function () {
                                $('#underUpdate').on('touchend', function () {
                                    var poliecy = $("input[ name='policy_num']").val();
                                    location.href="{:url('Insurer/update2')}?policy_num="+poliecy;

                                });

                            });
                        </script>
                        {/if}
                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item">
                            受损时间：{$data.goods_info.damage_at |substr=0,10}
                        </div>
                        <div class="item-card-content-item">
                            受损原因：{$data.goods_info.damage_result}
                        </div>
                        <div class="item-card-content-item" style="display:flex">
                            <div> 货品所在地：</div>
                            <div>
                                <div>{if !empty($data.goods_info.omit)}{$data.goods_info.omit}省{/if}{if !empty($data.goods_info.city)}{$data.goods_info.city}市{/if}{$data.goods_info.classify}</div>
                                <div>{$data.goods_info.address_detail}</div>
                            </div>
                        </div>
                        {if !empty($data.goods_info.other_report)}
                        {volist name="data.goods_info.other_report" id="voe"}
                        <div class="item-card-content-item">
                            第三方报告：{$voe.name}
                        </div>
                        {/volist}
                        {/if}

                    </div>
                    {if $data.status == 0 && !empty($data.bohui_info.under_return) }
                    <div class="edit-content">
                        {volist name="data.bohui_info.under_return" id="under_return"}
                        修改内容：{$under_return}<br/>
                        {/volist}
                    </div>
                    {/if}
                </div>
                <div class="item-card"  id="situation-html">
                    <div class="item-card-header">
                        <div>货品现状</div>
                        {if $data.status ==3 }
                        <div class="btn" id="situation_return">驳回</div>
                        <script>
                            $(document).on('click', '#situation_return', function () {
                                $.prompt('请输入驳回信息', function (value) {
                                    b=$('#situation-html').find('#situation_return-return');
                                    if(value.length == 0 && b.length>0 ) {
                                        console.log(123);
                                        b.remove();
                                        $('#situation_return').text('驳回');
                                        return;
                                    }
                                    if(value.length == 0 && b.length==0){
                                        return;
                                    }
                                    if(b.length>0){
                                        b.html('');
                                        $('#situation_return-return').append('修改内容：'+value+'<br />');
                                    }else {
                                        a=' <div class="edit-content" id="situation_return-return">';
                                        a+='修改内容：'+value+'<br />';
                                        a+='  </div>';
                                        $('#situation-html').append(a);
                                    }
                                    $('#situation_return').text('修改驳回原因');
                                });
                            });
                        </script>
                        {/if}
                        {if $data.status ==0 && $data.is_recordor !=1 &&  !empty($data.bohui_info.situation_return)}
                        <div class="btn" id="situationUpdate">修改</div>
                        <script>
                            $(function () {
                                $('#situationUpdate').on('touchend', function () {
                                    var poliecy = $("input[ name='policy_num']").val();
                                    location.href="{:url('Insurer/update3')}?policy_num="+poliecy;

                                });

                            });
                        </script>
                        {/if}
                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item">
                            货品在{$data.goods_info.present_at|substr=0,10}时的现状
                        </div>
                        {if !empty($data.goods_info.goods_list)}
                        {volist name="data.goods_info.goods_list" id="vol"}
                        <div class="item-card-content-item">
                            货品清单：{$vol.name}
                        </div>
                        {/volist}
                        {/if}
                        <div class="item-card-content-item">
                            货品描述：{$data.goods_info.goods_desc}
                        </div>
                        <div class="item-card-content-item" style="display:flex;align-items:center;">
                            <div>上传的照片：</div>
                            {if !empty($data.goods_info.present_img)}
                                {volist name="data.goods_info.present_img" id="vo"}
                                <div class="pre-view">
                                    <img src="{$vo}" style="width: 2.5rem;height: 2.5rem" class="i">
                                </div>
                            {/volist}
                            {/if}
                        </div>
                        <div class="item-card-content-item" style="display:flex;align-items:center;">
                            <div>上传的视频：</div>
                            {if !empty($data.goods_info.present_video)}
                            {volist name="data.goods_info.present_video" id="vo"}
                            <div class="pre-view">
                                <img src="{$vo}" style="width: 2.5rem;height: 2.5rem" class="i">
                            </div>
                            {/volist}
                            {/if}
                        </div>
                    </div>

                    {if $data.status == 0 && !empty($data.bohui_info.situation_return) }
                    <div class="edit-content">
                        {volist name="data.bohui_info.situation_return" id="situation_return"}
                        修改内容：{$situation_return}<br/>
                        {/volist}
                    </div>
                    {/if}

                </div>
                <div class="item-card" id="info_html">
                    <div class="item-card-header">
                        <div>物权信息</div>
                        {if $data.status ==3 }
                        <div class="btn" id="info_return">驳回</div>
                        <script>
                            $(document).on('click', '#info_return', function () {
                                $.prompt('请输入驳回信息', function (value) {
                                    b=$('#info_html').find('#info_return-return');
                                    if(value.length == 0 && b.length>0 ) {
                                        console.log(123);
                                        b.remove();
                                        $('#info_return').text('驳回');
                                        return;
                                    }
                                    if(value.length == 0 && b.length==0){
                                        return;
                                    }
                                    if(b.length>0){
                                        b.html('');
                                        $('#info_return-return').append('修改内容：'+value+'<br />');
                                    }else {
                                        a=' <div class="edit-content" id="info_return-return">';
                                        a+='修改内容：'+value+'<br />';
                                        a+='  </div>';
                                        $('#info_html').append(a);
                                    }
                                    $('#info_return').text('修改驳回原因');
                                });
                            });
                        </script>
                        {/if}
                        {if $data.status ==0 && $data.is_recordor !=1 &&  !empty($data.bohui_info.info_return)}
                        <div class="btn" id="infoUpdate">修改</div>
                        <script>
                            $(function () {
                                $('#infoUpdate').on('touchend', function () {
                                    var poliecy = $("input[ name='policy_num']").val();
                                    location.href="{:url('Insurer/update4')}?policy_num="+poliecy;
                                });

                            });
                        </script>
                        {/if}

                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item">
                            要求在{$data.goods_info.should_at|substr=0,10}前处置完成
                        </div>
                        <div class="item-card-content-item">
                            物权单位：{$data.goods_info.rem_company}
                        </div>
                        <div class="item-card-content-item">
                            联系人：{$data.goods_info.linkman}
                        </div>
                        <div class="item-card-content-item">
                            手机号：{$data.goods_info.connect_phone}
                        </div>
                    </div>
                    {if $data.status == 0 && !empty($data.bohui_info.info_return) }
                    <div class="edit-content">
                        {volist name="data.bohui_info.info_return" id="info_return"}
                        修改内容：{$info_return}<br/>
                        {/volist}
                    </div>
                    {/if}

                </div>
                {if $data.status !=3 && $data.status !=0}
                <div class="item-card">
                    <div class="item-card-header">
                        <div>授权书</div>
                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item" style="display:flex;align-items:center;">
                            <div>授权书：</div>
                            <div class="pre-view">
                                {if !empty($data.goods_info.author_report)}
                                <img src="{$data.goods_info.author_report}" style="width: 2.5rem;height: 2.5rem" class="i">
                                {/if}
                            </div>
                        </div>
                    </div>
                    <!--{if $data.status == 0 }-->
                    <!--<div class="edit-content">-->
                        <!--修改内容：出险险种选择不正确-->
                    <!--</div>-->
                    <!--{/if}-->

                </div>
                {/if}
                {in name="data.status" value="7,8" }
                <div class="item-card">
                    <div class="item-card-header">
                        <div>物权人委托书</div>
                        <!--{if $data.status ==0 && $data.is_recordor !=1  }-->
                        <!--<div class="btn">修改</div>-->
                        <!--{/if}-->
                    </div>
                    <div class="item-card-content">
                        <div class="item-card-content-item" style="display:flex;align-items:center;">
                            <div>委托书：</div>
                            <div class="pre-view">
                                {$data.goods_info.author_report}
                            </div>
                        </div>
                    </div>


                </div>
                {/in}
                <div class="btn-box">
                    {if $data.status ==1 }

                    <div class="flex size-m">
                        <div class="pre-step my-btn" style="width: 47%;" id="delect">
                            <span style="background-color: rgb(255, 255, 255); color:#e4393c;border:1px solid #e4393c;">删除</span>
                        </div>
                        <div class="pre-step my-btn" style="width: 47%;" id="submit">
                            <span class="active">编辑</span>
                        </div>
                    </div>

                    <script>
                        $(function () {

                            $('#submit').on('touchend', function () {
                                var poliecy = $("input[ name='policy_num']").val();
                                location.href="{:url('insurer/step1')}?policy_num="+poliecy;
                            });
                            $('#delect').on('touchend', function () {
                                $.confirm('确认要删除吗?', function () {
                                    var poliecy = $("input[ name='policy_num']").val();
                                    $.ajax({
                                        type: 'POST',
                                        url: "{:url('insurer/delete')}",
                                        data: {
                                            'policy_num': poliecy,
                                        },
                                        dataType: 'json',
                                        success: function (Json) {
                                            if (Json.code == 200) {
                                                $.toast("删除成功",3000);
                                                location.href="{:url('insurer/getList')}";
                                            } else {
                                                $.toast(Json.msg);
                                            }
                                        }
                                    });

                                });
                            });
                        })
                    </script>
                    {/if}
                    {if $data.status ==3 }
                    <div class="flex size-m">
                        <div class="pre-step my-btn" style="width: 47%;" id="reject">
                            <span style="background-color: rgb(255, 255, 255); color:#e4393c;border:1px solid #e4393c;">提交驳回修改</span>
                        </div>
                        <div class="pre-step my-btn" style="width: 47%;" id="confirm">
                            <span class="active">上传授权书并提交</span>
                        </div>
                    </div>
                    <script>
                        $(function () {
                            $('#confirm').on('touchend', function () {
                                var poliecy = $("input[ name='policy_num']").val();
                                location.href="{:url('insurer/confirmSubmit')}?policy_num="+poliecy;
                            });


                            $('#reject').on('touchend', function () {
                                var goods_return = $("#prompt-ok-return").text();
                                var under_return = $("#under_return-return").text();
                                var situation_return = $("#situation_return-return").text();
                                var info_return = $("#info_return-return").text();
                                var p_id = $("input[ name='p_id']").val();
                                if(goods_return == null && under_return==null && situation_return==null && info_return==null){
                                    $.alert('没有驳回原因');
                                    return;
                                }
                                if(goods_return != null){
                                    var a= goods_return.split('：');
                                    goods_return=a[1];
                                }else {
                                    goods_return='';
                                }
                                if(under_return != null){
                                    var b= under_return.split('：');
                                    under_return=b[1];
                                }else {
                                    under_return='';
                                }
                                if(situation_return != null){
                                    var c= situation_return.split('：');
                                    situation_return=c[1];
                                }else {
                                    situation_return='';
                                }
                                if(info_return != null){
                                    var d= info_return.split('：');
                                    info_return = d[1];
                                }else {
                                    info_return='';
                                }

                                $.ajax({
                                    type: 'POST',
                                    url: "{:url('insurer/reject')}",
                                    data: {
                                        'p_id': p_id,
                                        'goods_return': goods_return,
                                        'under_return': under_return,
                                        'situation_return': situation_return,
                                        'info_return': info_return
                                    },
                                    dataType: 'json',
                                    success: function (Json) {
                                        if (Json.code == 200) {
                                            $.alert('驳回成功');
                                            location.href="{:url('insurer/getList')}";
                                        } else {
                                            $.alert(Json.msg);
                                        }
                                    }
                                });

                            });
                        })
                    </script>
                    {/if}
                    {if $data.status == 0 && $data.is_recordor !=1 }
                    <div class="my-btn size-m">
                        <span class="active" id="update">修改完提交</span>
                    </div>
                    <script>
                        $(function () {
                            $('#update').on('touchend', function () {
                                var poliecy = $("input[ name='policy_num']").val();
                                $.ajax({
                                    type: 'POST',
                                    url: "{:url('insurer/confirmSubmit')}",
                                    data: {
                                        'policy_num': poliecy,
                                    },
                                    dataType: 'json',
                                    success: function (Json) {
                                        if (Json.code == 200) {
                                            $.alert('提交成功');
                                            location.href="{:url('insurer/getList')}";
                                        } else {
                                            $.alert('提交失败');
                                        }
                                    }
                                });
                            });
                        })

                    </script>
                    {/if}
                </div>
                {/if}
            </div>
        </div>
    </div>

</body>
<script>
    layui.use(['layer'], function(){
        $('.i').on('click',function(){
            var th=$(this);
            var img=th[0].currentSrc;
            layer.open({
                type: 1,
                title: false,
                closeBtn: 0,
                area: '80%',
                skin: 'layui-layer-nobg', //没有背景色
                shadeClose: true,
                content:'<img src="'+img+'" style="width:100%;">'
            });
        });
    });

</script>
</html>